package org.example;

import com.oracle.tools.packager.IOUtils;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @author Yyming
 * @version 10.0
 * Created by Yyming on 2020/9/21
 */
public class Buf {
    private static final String path = "/Users/yeym/帆软/env-1/.gradle/caches/modules-2/files-2.1";
    private static final String jars = "/Users/yeym/帆软/env-1/jars/";
    public static void main(String[] args) throws IOException {
        copyJars(path);
    }

    private static void copyJars(String path) throws IOException {
        File file = new File(path);
        if (file.isDirectory()) {
            File[] files = file.listFiles();
            for (File file1 : files) {
                if (file1.isDirectory()) {
                    copyJars(file1.getAbsolutePath());
                } else {
                    if (file1.getName().endsWith(".jar")) {
                        System.out.println(file1.getAbsolutePath());
                        File copy = new File(jars + file1.getName());
                        if (!copy.exists()) {
                            Files.copy(file1.toPath(), Paths.get(jars + file1.getName()));
                        }
                    }
                }
            }
        }
    }
}

